package com.wy.OneClient.pojo;

import com.wy.OneClient.Info;

import java.io.Serializable;
import java.util.Objects;

//关于端口姐ip的地址信息
public class AddressInfo implements Serializable {
    private static final long serialVersionUID = 1L;
    private String localAddressIp;
    private Integer localPort;
    private String targetAddressIp;
    private Integer targetPort;

    public AddressInfo(String localAddressIp, Integer localPort, String targetAddressIp, Integer targetPort) {
        this.localAddressIp = localAddressIp;
        this.localPort = localPort;
        this.targetAddressIp = targetAddressIp;
        this.targetPort = targetPort;
    }

    public AddressInfo() {
        defaultAddressInfo();
    }
    public void defaultAddressInfo(){
        this.localAddressIp = Info.LOCALADDRESSDEFAULTIP;
        this.localPort = Info.LOCALADDRESSDEFAULTPORT;
        this.targetAddressIp = Info.TARGETADDRESSIP;
        this.targetPort = Info.TARGETADDRESSPORT;
    }

    public String getLocalAddressIp() {
        return localAddressIp;
    }

    public void setLocalAddressIp(String localAddressIp) {
        this.localAddressIp = localAddressIp;
    }

    public Integer getLocalPort() {
        return localPort;
    }

    public void setLocalPort(Integer localPort) {
        this.localPort = localPort;
    }

    public String getTargetAddressIp() {
        return targetAddressIp;
    }

    public void setTargetAddressIp(String targetAddressIp) {
        this.targetAddressIp = targetAddressIp;
    }

    public Integer getTargetPort() {
        return targetPort;
    }

    public void setTargetPort(Integer targetPort) {
        this.targetPort = targetPort;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        AddressInfo that = (AddressInfo) o;
        return Objects.equals(localAddressIp, that.localAddressIp) &&
                Objects.equals(localPort, that.localPort) &&
                Objects.equals(targetAddressIp, that.targetAddressIp) &&
                Objects.equals(targetPort, that.targetPort);
    }

    @Override
    public int hashCode() {
        return Objects.hash(localAddressIp, localPort, targetAddressIp, targetPort);
    }

    @Override
    public String toString() {
        return "AddressInfo{" +
                "localAddressIp='" + localAddressIp + '\'' +
                ", localPort=" + localPort +
                ", targetAddressIp='" + targetAddressIp + '\'' +
                ", targetPort=" + targetPort +
                '}';
    }
}
